Configure Groovy Interception at the Gate Transaction Level

The gate forms in N4 support Groovy interception (a Groovy hook) at two levels:

This topic covers the Groovy interception at the gate transaction level. You can use a GATE_UI_FIELD_INTERCEPTOR (on page 1) code extension to read data from N4 or perform calculations and automatically fill in certain fields in the gate forms.

To configure and use the new Groovy code extension from the gate forms:

  1. Add a new code extension of type, GATE_UI_FIELD_INTERCEPTOR (on page 1).

  1. In the code extension, override the following two methods of the AbstractGateFormFieldInterceptor class:

After N4 executes the code extension, the gate form fields are filled in based on the field values in the Map returned by these methods. If the Map is null/empty, then the code extension does not do anything.

  1. From the Gate Configurations view, add the Custom Transaction Action button to the gate transaction type for the gate stage where you want to execute the code extension.

 

Sample Scenario using the Groovy code extension at the Gate Transaction Level

This scenario is for configuring the Custom Transaction Action button and the related code extension for a Receive Export (RE) gate transaction type.

Setup the gate configuration and the Groovy hook

The following sample configuration is based on a scenario where the GATE_UI_FIELD_INTERCEPTOR code extension is added for the Receive Export (RE) gate transaction type.

When a user tabs out of the Container Number field, N4 invokes the Groovy code extension and automatically fills in the following fields for the gate transaction:

When a user clicks the Custom Transaction Action button, N4 invokes the Groovy code extension and automatically fills in the following fields for the gate transaction:

To configure and use the new Groovy code extension from the gate forms:

  1. Add a new code extension of the type, GATE_UI_FIELD_INTERCEPTOR.

  1. From the Gate Configurations view, add the Custom Transaction Action button to the Receive Export (RE) gate transaction type for the gate stage where you want to execute the code extension.

  2. From the Operations Gate menu, open the gate form for the gate stage at which you added the button.

  3. Select the Receive Export gate transaction type.

N4 displays the Custom Transaction Action button in the transaction panel.

  1. Enter the Container Number for a pre-advised unit in the gate form.

  2. Tab out of the Container Number field and notice that N4 invokes the Groovy code extension and populates the following fields:

  1. Click Custom Transaction Action and notice that N4 invokes the Groovy code extension and populates the following fields:

 

Fields supported by the GATE_UI_FIELD_INTERCEPTOR code extension type

A code extension based on the GATE_UI_FIELD_INTERCEPTOR code extension type can be used to intercept and customize the following gate transaction fields: